package com.cl.pattern.mediator;

/**
 * @ClassName HouseMediator
 * @Description
 * @Author Small
 * @Date 2020/7/9 18:22
 * @Version 1.0
 **/
public class HouseMediator implements IMediator {

    // 中介者 拥有同事类的所有引用


    private SmallHouseColleague smallHouseColleague;
    private TwoHouseColleague twoHouseColleague;
    private TreeeHouseColleague treeeHouseColleague;

    /**
     * 定义同事类之间的通信
     * @param type
     */
    @Override
    public void common(String type) {
        switch (type) {
            case "单间":
                smallHouseColleague.handle();
                break;
            case "两居室":
                twoHouseColleague.handle();
                break;
            case "三居室":
                treeeHouseColleague.handle();
                break;
            default:
                break;
        }
    }


    public SmallHouseColleague getSmallHouseColleague() {
        return smallHouseColleague;
    }

    public void setSmallHouseColleague(SmallHouseColleague smallHouseColleague) {
        this.smallHouseColleague = smallHouseColleague;
    }

    public TwoHouseColleague getTwoHouseColleague() {
        return twoHouseColleague;
    }

    public void setTwoHouseColleague(TwoHouseColleague twoHouseColleague) {
        this.twoHouseColleague = twoHouseColleague;
    }

    public TreeeHouseColleague getTreeeHouseColleague() {
        return treeeHouseColleague;
    }

    public void setTreeeHouseColleague(TreeeHouseColleague treeeHouseColleague) {
        this.treeeHouseColleague = treeeHouseColleague;
    }
}
